﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MyBank
{
    public partial class Form1 : Form
    {
        CurrentAccount currentAccount = new CurrentAccount();

        public Form1(CurrentAccount currentAccount)
        {
            this.currentAccount = currentAccount;
            InitializeComponent();
        }


        private void btn_login_Click(object sender, EventArgs e)
        {
            if(currentAccount.login_Account_by_ID(int.Parse(text_ID.Text), text_pwd.Text))
            {
                MessageBox.Show("登录成功！" + CurrentAccount.account_Name);
                // 跳转到背单词主界面
                this.DialogResult = DialogResult.OK;
                this.Dispose(); // 释放资源
                this.Close();   // 关闭窗口
            }else
            {
                MessageBox.Show("登陆失败！！请检查密码是否正确或用户名是否存在！！");
            }
        }

        private void btn_reg_Click(object sender, EventArgs e)
        {
            reg r = new reg();
            r.Show();
        }
    }
}
